package jvlite.authority;

import java.lang.reflect.Method;
import java.util.List;

import jvlite.exception.AuthException;

public abstract class AbstractAuthManager implements IAuthorityManager {
	
	protected static String errPagePath;
	protected static String authWayName;
	protected static AuthDataSource authDataSource;

	static{
		errPagePath = "/error.jsp";
		authWayName = DefaultAuthWay.ANY;
		authDataSource = new AuthDataSource();
	}
	
	@Override
	public abstract Boolean checkClzAuth(Object target, List<String> hasAuthList);

	@Override
	public abstract Boolean checkMtdAuth(Object target, Method method,
			List<String> hasAuthList);
	
	@Override
	public abstract Boolean isGuest();

	public static String getErrPagePath() {
		return errPagePath;
	}

	public static void setErrPagePath(String errPagePath) {
		AbstractAuthManager.errPagePath = errPagePath;
	}

	public static String getAuthWayName() {
		return authWayName;
	}

	public static void setAuthWayName(String authWayName) {
		AbstractAuthManager.authWayName = authWayName;
	}

	public AuthDataSource getAuthDataSource() {
		return authDataSource;
	}

	public void setAuthDataSource(AuthDataSource authDataSource) {
		AbstractAuthManager.authDataSource = authDataSource;
	}

	public abstract void checkAuths(Object target, Method method) throws AuthException;

}
